#include <iomanip>
#include <iostream>
#include <iostream>
#include "Character.h"


using namespace std;



/**
 * Prints a Character Sheet
 * @param void
 * @see printCombatFactor()
 * @see printFurtivity()
 * @see printEquipment()
 * @return void
 */
void Character::print()
{
	system("cls");
	cout << endl << endl;
	cout << "   ,-----------------------------------------------------------,==." << endl;
	cout << "  /                      CHARACTER SHEET                      /__  \\" << endl;
	cout << " |                                                           |(_\\ /" << endl;
	cout << " |                                                           \\-`-'" << endl;
	cout << " |                                                           /" << endl;
	cout << " | " << setw(60) << setfill('_') << "|" << endl;
	cout << " | Character ID: " << m_id << endl;
	cout << " | Name: " << m_strName << endl;
	cout << " | Rank: " << m_iLevel << endl;
	cout << " | Experience: " << m_iXP << "/" << m_iMaxXP << endl;
	cout << " |" << endl;
	cout << " |" << setw(60) << setfill('_') << "|" << endl;
	cout << " | Health Points: " << m_iHP << "/" << m_iMaxHP <<  endl;
	cout << " | Magic Points: " << m_iMP << "/" << m_iMaxMP <<  endl;
	cout << " |" << endl;
	cout << " |" << setw(60) << setfill('_') << "|" << endl;
	printCombatFactor();
	printFurtivity();
	printEquipment();
	cout << " |                                                           |" << endl;
	cout << " |                                                           {____"<< endl;
	cout << " |                                                           |__( \\" << endl;
	cout << " \\                                                           \\    /" << endl;
	cout << "  `-----------------------------------------------------------`=='" << endl;
	cout << endl;
	system("pause");
	system("cls");
}


/**
 * Prints combat attributes for Print() function
 * @param void
 * @see print()
 * @return void
 */
void Character::printCombatFactor()
{
	cout << " | COMBAT FACTORS" << endl;
	cout << " |" << setw(60) << setfill('_') << "|" << endl;
	cout << setfill(' ') << " | Attack: " << setw(2) << m_iPhysicalAttack << "\t\tDefense: "<< setw(2) << m_iPhysicalDefense << endl;
	cout << setfill(' ') << " | Magical Attack: " << setw(2) << m_iMagicalAttack << "\tMagical Defense: "<< setw(2) << m_iMagicalDefense << endl;
	cout << " | Evasion: " << m_iEvasion << endl;
	cout << " |" << endl;
	cout << " |" << setw(60) << setfill('_') << "|" << endl;
}


/**
 * Prints furtivity attributes for Print() function
 * @param void
 * @see print()
 * @return void
 */
void Character::printFurtivity()
{
	cout << " | FURTIVITY FACTORS" << endl;
	cout << " |" << setw(60) << setfill('_') << "|" << endl;
	cout << setfill(' ') << " | Stealth: " << setw(2) << m_iStealth << "\t\tPerception: "<< setw(2) << m_iPerception << endl;
	cout << " |" << endl;
	cout << " |" << setw(60) << setfill('_') << "|" << endl;
}


/**
 * Prints equipment for Print() function
 * @param void
 * @see print()
 * @return void
 */
void Character::printEquipment()
{
	cout << " | EQUIPMENT" << endl;
	cout << " |" << setw(60) << setfill('_') << "|" << endl;
	cout << " | Gold: " << m_iGold << endl;
	cout << " |" << endl;
	cout << " | Right Hand:\t";
	if (m_rightHand != 0)
	{
		cout << m_rightHand->getName() << endl;
	}
	else
	{
		cout << "<empty>"  << endl;
	}
	cout << " | Left Hand:\t";
	if (m_leftHand != 0)
	{
		cout << m_leftHand->getName() << endl;
	}
	else
	{
		cout << "<empty>"  << endl;
	}
	cout << " | Armor:\t";
	if (m_body != 0)
	{
		cout << m_body->getName() << endl;
	}
	else
	{
		cout << "<empty>"  << endl;
	}
	cout << " | Backpack : " << endl;
	for (unsigned int i = 0; i < m_backpack.size(); ++i)
	{
		cout << " |\t-" << m_backpack[i]->getName() << endl;
	}
}


/**
 * Prints all items and their attributes in equipment list
 * @param void
 * @see Item::Print()
 * @return void
 */
void Character::printOnlyEquipment()
{
	cout << "========================================" << endl;
	cout << "         EQUIPEMENT LIST" << endl;
	cout << "========================================" << endl;
	for (unsigned int i = 0; i < m_equipment.size(); ++i)
	{
		m_equipment[i]->print();
	}
	cout << "========================================" << endl;
}


/**
 * Prints all items name and type in equipment list
 * @param void
 * @see Item::miniPrint()
 * @return void
 */
void Character::printOnlySimpleEquipment()
{
	cout << "========================================" << endl;
	cout << "         EQUIPEMENT" << endl;
	cout << "========================================" << endl;
	for (unsigned int i = 0; i < m_equipment.size(); ++i)
	{
		m_equipment[i]->miniPrint();
	}
	cout << "========================================" << endl;
}


/**
 * Prints all items and their attributes in baclpack list
 * @param void
 * @see Item::Print()
 * @return void
 */
void Character::printOnlyBackpack()
{
	cout << "========================================" << endl;
	cout << "         BACKPACK LIST" << endl;
	cout << "========================================" << endl;
	for (unsigned int i = 0; i < m_backpack.size(); ++i)
	{
		m_backpack[i]->print();
	}
	cout << "========================================" << endl;
}


/**
 * Prints all items name and type in backpack list
 * @param void
 * @see Item::miniPrint()
 * @return void
 */
void Character::printOnlySimpleBackpack()
{
	cout << "========================================" << endl;
	cout << "         BACKPACK " << endl;
	cout << "========================================" << endl;
	for (unsigned int i = 0; i < m_backpack.size(); ++i)
	{
		m_backpack[i]->miniPrint();
	}
	cout << "========================================" << endl;
}


/**
 * Prints item and attributes equiped in right hand
 * @param void
 * @see Item::Print()
 * @return void
 */
void Character::printOnlyRightHand()
{
	cout << "========================================" << endl;
	cout << "         RIGHT HAND" << endl;
	cout << "========================================" << endl;
	if (m_rightHand != 0)
	{
		m_rightHand->print();
	}
	cout << "========================================" << endl;
}


/**
 * Prints item and attributes equiped in left hand
 * @param void
 * @see Item::Print()
 * @return void
 */
void Character::printOnlyLeftHand()
{
	cout << "========================================" << endl;
	cout << "         LEFT HAND" << endl;
	cout << "========================================" << endl;
	if  (m_leftHand != 0)
	{
		m_leftHand->print();
	}
	cout << "========================================" << endl;
}


/**
 * Prints item and attributes worn on body
 * @param void
 * @see Item::Print()
 * @return void
 */
void Character::printOnlyBody()
{
	cout << "========================================" << endl;
	cout << "         BODY" << endl;
	cout << "========================================" << endl;
	if  (m_body != 0)
	{
		m_body->print();
	}
	cout << "========================================" << endl;
}
